/**
 * AdminUser 业务逻辑实现类
 * @author WangXinLei
 * @date 2014-11-04
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.AdminUser;
import com.chnbst.bstyun.model.vo.AdminUserVo;
import com.chnbst.bstyun.service.AdminUserService;

@Transactional
@Service
public class AdminUserServiceImpl  extends BaseService implements AdminUserService {

	//声明工作空间
	private final static String nameSpace = "com.chnbst.bstyun.mapper.AdminUserMapper";
		
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertAdminUser(AdminUser adminUser) {
		return DaoHelper.insert(nameSpace, "insertAdminUser", adminUser);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateAdminUser(AdminUser adminUser) {
		return DaoHelper.update(nameSpace, "updateAdminUser", adminUser);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public AdminUser selectById(Integer adminId) {
		return (AdminUser) DaoHelper.query(nameSpace, "selectById", adminId);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public AdminUser selectByName(String adminName) {
		return (AdminUser) DaoHelper.query(nameSpace, "selectByName", adminName);
	}

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<AdminUser> selectAllAdminUsers() {
		return (List<AdminUser>)DaoHelper.list(nameSpace, "selectAllAdminUsers", "");
	}

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<AdminUserVo> selectAllAdminUsersVo(Map<String, Object> map) {
		return (List<AdminUserVo>)DaoHelper.list(nameSpace, "selectAllAdminUsersVo", map);
	}
}
